# Author: HZT
# Date: 2023/9/7
import time

import page
from base.base import Base
from utils import click_paste_img


class WebSkJk(Base):
    # 获取收卡列表元素
    def sk_jk_get_sklb(self):
        return self.base_find_first(page.web_sk_sklb)

    # 点击收卡中心
    def sk_jk_click_skzx(self):
        # # 定位收卡中心
        # switch = self.sk_jk_get_sklb()
        # # 判断开关状态
        # if "active" in switch.get_attribute("class"):
        #     # 列表是未开状态，点击下拉列表
        #     self.base_find_first(page.web_sk_skzx).click()
        self.base_find_first(page.web_sk_skzx).click()

    # 点击接收卡种tsteam
    def sk_jk_click_jssteam(self):
        self.base_click(page.web_sk_jk_jssteam)

    # 点击接收卡种tsephora
    def sk_jk_click_jssephora(self):
        self.base_click(page.web_sk_jk_jssephora)

    # 点击接卡
    def sk_jk_click_jk(self):
        self.base_find_first(page.web_sk_jk_jk).click()

    # 获取开始接卡元素
    def sk_jk_get_ksjk(self):
        return self.base_find(page.web_sk_jk_ksjk)

    # 点击开始接卡
    def sk_jk_click_ksjk(self):
        self.base_click(page.web_sk_jk_ksjk)

    # 点击取消
    def sk_jk_click_qx(self):
        self.base_click(page.web_sk_jk_qx)

    # 获取弹窗提示消息
    def sk_jk_get_tcts(self):
        return self.base_get_text(page.web_sk_jk_tcts)

    # 点击弹窗OK
    def sk_jk_click_tcok(self):
        self.base_click(page.web_sk_jk_tcok)

    # 获取查看卡密元素列表
    def sk_jk_get_ckkms(self):
        return self.base_finds(page.web_sk_jk_ckkm)

    # 点击查看卡密
    def sk_jk_click_ckkm(self):
        self.base_click(page.web_sk_jk_ckkm)

    # 点击上传余额图
    def sk_jk_click_scye(self):
        self.base_find_first(page.web_sk_jk_scye).click()

    # 余额图提示
    def sk_jk_get_yetts(self):
        return self.base_get_text(page.web_sk_jk_yetts)

    # 获取余额图上传元素
    def sk_jk_get_yetsc(self):
        return self.base_find(page.web_sk_jk_yetsc)

    # 点击余额图提交
    def sk_jk_click_yettj(self):
        self.base_click(page.web_sk_jk_yettj)

    # 点击处理成功
    def sk_jk_click_clcg(self):
        self.base_find_first(page.web_sk_jk_clcg).click()

    # 点击处理成功提交
    def sk_jk_click_cgtj(self):
        self.base_click(page.web_sk_jk_cgtj)

    # 点击处理失败
    def sk_jk_click_clsb(self):
        self.base_find_first(page.web_sk_jk_clsb).click()

    # 点击失败原因
    def sk_jk_click_sbyy(self):
        self.base_click(page.web_sk_jk_sbyy)

    # 点击卡片信息有误
    def sk_jk_click_xxyw(self):
        self.base_click(page.web_sk_jk_xxyw)

    # 点击余额不足
    def sk_jk_click_yebz(self):
        self.base_click(page.web_sk_jk_yebz)

    # 点击卡种有误
    def sk_jk_click_kzyw(self):
        self.base_click(page.web_sk_jk_kzyw)

    # 点击其他
    def sk_jk_click_qt(self):
        self.base_click(page.web_sk_jk_qt)

    # 失败图片
    def sk_jk_get_sbtp(self):
        return self.base_find(page.web_sk_jk_sbtp)

    # 获取图片提示
    def sk_jk_get_tpts(self):
        return self.base_get_text(page.web_sk_jk_tpts)

    # 点击失败提交
    def sk_jk_click_sbtj(self):
        self.base_click(page.web_sk_jk_sbtj)

    # 点击修改卡种
    def sk_jk_click_xgkz(self):
        self.base_find_first(page.web_sk_jk_xgkz).click()

    # 输入面值
    def sk_jk_input_mz(self, text):
        self.base_input(page.web_sk_jk_mz, text)

    # 点击修改提交
    def sk_jk_click_xgtj(self):
        self.base_click(page.web_sk_jk_xgtj)

    # 获取修改提示
    def sk_jk_get_xgts(self):
        return self.base_get_text(page.web_sk_jk_xgts)

    # 获取修改图片元素
    def sk_jk_get_xgtp(self):
        return self.base_find(page.web_sk_jk_xgtp)

    # 获取修改成功
    def sk_jk_get_xgcg(self):
        return self.base_get_text(page.web_sk_jk_xgcg)

    # 点击延长时间
    def sk_jk_click_ycsj(self):
        self.base_click(page.web_sk_jk_ycsj)

    # 点击添加操作人
    def sk_jk_click_tjczr(self):
        self.base_click(page.web_sk_jk_tjczr)

    # 点击压卡
    def sk_jk_click_yk(self):
        self.base_click(page.web_sk_jk_yk)

    # 输入延长原因
    def sk_jk_input_ycyy(self):
        self.base_input(page.web_sk_jk_ycyy, "来不及处理！。。。")

    # 点击延长提交
    def sk_jk_click_yctj(self):
        self.base_click(page.web_sk_jk_yctj)

    # 获取延长提示
    def sk_jk_get_ycts(self):
        return self.base_get_text(page.web_sk_jk_ycts)

    # 点击延长取消
    def sk_jk_click_ycqx(self):
        self.base_click(page.web_sk_jk_ycqx)

    # 点击操作人
    def sk_jk_click_czr(self):
        self.base_click(page.web_sk_jk_czr)

    # 点击test001用户
    def sk_jk_click_yh(self):
        self.base_click(page.web_sk_jk_yh)

    # 获取压卡的元素
    def sk_jk_get_yk(self):
        return self.base_find(page.web_sk_jk_yk)

    # 点击添加提交
    def sk_jk_click_tjtj(self):
        self.base_click(page.web_sk_jk_tjtj)

    # 输入压卡时间
    def sk_jk_input_yksj(self, text):
        self.base_input(page.web_sk_jk_yksj, text)

    # 获取处理成功元素
    def sk_jk_get_clcg(self):
        return self.base_find(page.web_sk_jk_clcg)

    # 点击压卡提交
    def sk_jk_click_yktj(self):
        self.base_click(page.web_sk_jk_yktj)

    # 获取用户元素
    def sk_jk_get_yh(self):
        return self.base_find(page.web_sk_jk_yh)

    # 获取卡片ID元素列表
    def sk_jk_get_ids(self):
        return self.base_finds(page.web_sk_jk_id)

    # 获取卡密pin元素列表
    def sk_jk_get_pins(self):
        return self.base_finds(page.web_sk_jk_pin)

    # 获取卡密代码元素列表
    def sk_jk_get_dms(self):
        return self.base_finds(page.web_sk_jk_dm)

    def sk_jk_get_dm(self):
        return self.base_get_text(page.web_sk_jk_dm)

    def sk_jk_get_pin(self):
        return self.base_get_text(page.web_sk_jk_pin)

    # 获取面额元素列表
    def sk_jk_get_mes(self):
        return self.base_finds(page.web_sk_jk_me)

    # 获取汇率元素列表
    def sk_jk_get_hls(self):
        return self.base_finds(page.web_sk_jk_hl)

    # 点击非礼品卡图
    def sk_jk_click_flp(self):
        self.base_click(page.web_sk_jk_flp)

    # 点击设置失败
    def sk_jk_click_szsb(self):
        self.base_click(page.web_sk_jk_szsb)

    # 点击提交成功
    def sk_jk_click_tjcg(self):
        self.base_click(page.web_sk_jk_tjcg)

    # 设置失败弹窗
    def sk_jk_get_szsbtc(self):
        return self.base_find(page.web_sk_jk_tjcg)



    # 组合上传余额图业务
    def sk_jk_scyet(self, driver):
        self.sk_jk_get_ckkms()[0].click()
        time.sleep(1)
        self.sk_jk_click_scye()
        element = self.sk_jk_get_yetsc()
        click_paste_img("test001.png", element, driver)
        time.sleep(2)
        self.sk_jk_click_yettj()
        time.sleep(1)
